/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mygame;

import com.jme3.app.Application;
import com.jme3.app.state.AppStateManager;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

/**
 *
 * @author Paulo
 */
public class MenuState extends SimpleAppState implements ScreenController {
    
    private NiftyJmeDisplay niftyDisplay;
    
    @Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
        
        niftyDisplay = new NiftyJmeDisplay(this.app.getAssetManager(), this.app.getInputManager(), this.app.getAudioRenderer(), this.app.getGuiViewPort());
        
        Nifty nifty = niftyDisplay.getNifty();
        nifty.fromXml("Interface/menuPrincipal.xml", "mainMenu", this);
        
        this.app.getGuiViewPort().addProcessor(niftyDisplay);
    }
    
    @Override
    public void update(float tpf) {
        //TODO: implement behavior during runtime
    }
    
    @Override
    public void cleanup() {
        super.cleanup();
        
        this.app.getGuiViewPort().removeProcessor(niftyDisplay);
    }

    public void bind(Nifty nifty, Screen screen) {
    }

    public void onStartScreen() {
    }

    public void onEndScreen() {
    }
    
    public void newGame() {
        app.getStateManager().detach(this);
        app.getStateManager().attach(new SceneState());
    }
    
    public void loadGame() {
        
    }
    
    public void multiplayer() {
        
    }
    
    public void settings() {
        
    }
    
    public void quitGame() {
        app.stop();
    }
}
